QuickOPC User's Guide and Reference
OPC-A&E Area or Source Dialog
Features > User Interface > OPC Common Dialogs > OPC-A&E Common Dialogs > OPC-A&E Area or Source Dialog
In This Topic

General

Icon:

With AEAreaOrSourceDialog, your applicate can integrate a dialog box from which the user can select OPC-A&E event areas or sources:

The MultiSelect property determines whether the dialog allows the user to select multiple nodes as output.

Use the ServerDescriptor property to specify the OPC Alarms&Events server whose items are to be browsed, and call the ShowDialog method. If the result is equal to DialogResult.OK, the user has finished the selection, and information about it can be retrieved.

When the dialog is in single-select mode, you can obtain the information about the selected event area or source from the NodeDescriptor property. When the dialog is in multi-select mode, the information about the selected event areas is in the AreaElements property, and the information about the selected event sources in the SourceElements property; all event areas and nodes are available together in the NodeElements property.

Example

// This example shows how to let the user browse for OPC Alarms&Events areas or sources. 

using System.Linq;
using System.Windows.Forms;
using OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing;

namespace FormsDocExamples._AEAreaOrSourceDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var areaOrSourceDialog = new AEAreaOrSourceDialog
            {
                ServerDescriptor = {ServerClass = "OPCLabs.KitEventServer.2"}
            };

            DialogResult dialogResult = areaOrSourceDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            string nodeElementsString = string.Join("\n", areaOrSourceDialog.NodeElements.Select(element => element));
            MessageBox.Show(owner, nodeElementsString);
        }
    }
}
# This example shows how to let the user browse for OPC Alarms&Events areas or sources.

# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from System.Windows.Forms import *
from OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing import *


areaOrSourceDialog = AEAreaOrSourceDialog()
areaOrSourceDialog.ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"

dialogResult = areaOrSourceDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
    exit()

# Display results.
print()
for nodeElement in areaOrSourceDialog.NodeElements:
    print(nodeElement)

 

Advanced

If you want to change the parameters of the client object the component uses to perform its OPC operations, you can use the ClientSelector Property.

 

See Also

Examples - User Interface